package com.example.myapplication2;

import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Color;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class choose extends AppCompatActivity {
    private Button PPG;
    private Button ACC;
    private Button GRY;
    private  Button confirm;
//    int[] choose={0,0,0};

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose);
//        checkBox=(Button) findViewById(R.id.cb);
//        checkBox.setOnClickListener();
        PPG=(Button) findViewById(R.id.btn_PPG);


        PPG.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                switch (para.choose[0]){
                    case 0:
//                        PPG.setActivated(false);
                        para.choose[0]=1;
                        PPG.setBackgroundResource(R.drawable.shape2);

                        break;
                    case 1:
//                        PPG.setActivated(true);
                        para.choose[0]=0;
                        PPG.setBackgroundResource(R.drawable.shape);

                        break;
                }
                Log.d("","choose："+para.choose[0]+" "+para.choose[1]+" "+para.choose[2]+"");
            }
        });
        ACC=(Button) findViewById(R.id.btn_ACC);
        ACC.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                switch (para.choose[1]){
                    case 0:
//                        PPG.setActivated(false);
                        para.choose[1]=1;
                        ACC.setBackgroundResource(R.drawable.shape2);

                        break;
                    case 1:
//                        PPG.setActivated(true);
                        para.choose[1]=0;
                        ACC.setBackgroundResource(R.drawable.shape);

                        break;
                } Log.d("","choose："+para.choose[0]+" "+para.choose[1]+" "+para.choose[2]+"");
            }
        });
        GRY=(Button) findViewById(R.id.btn_GRY);
        GRY.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                switch (para.choose[2]){
                    case 0:
//                        PPG.setActivated(false);
                        para.choose[2]=1;
                        GRY.setBackgroundResource(R.drawable.shape2);

                        break;
                    case 1:
//                        PPG.setActivated(true);
                        para.choose[2]=0;
                        GRY.setBackgroundResource(R.drawable.shape);

                        break;
                } Log.d("","choose："+para.choose[0]+" "+para.choose[1]+" "+para.choose[2]+"");
            }
        });
        confirm=(Button) findViewById(R.id.confirm);
        confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                    if(para.choose[0]==0&&para.choose[1]==0&&para.choose[2]==0) {
                        Toast.makeText(getApplicationContext(),"至少选择一种",Toast.LENGTH_LONG).show();
                    }
                    else {
                        Intent intent = new Intent(choose.this, action.class);
                        startActivity(intent);
                    }
            }
        });

    }

}